<template>
    <div>
        <input
            class="input is-small"
            type="text"
            v-model="input"
            :placeholder="placeholder"
            @keyup.enter="monitorEnterKey">
    </div>

</template>

<script lang="ts">
import { Component, Prop, Vue } from 'vue-property-decorator'
import { Note } from '@/model/Note'

@Component({})
export default class InputComponent extends Vue {
    @Prop({type:String,default:""})
    placeholder!:string
    name = 'InputComponent'
    input = "";
    public monitorEnterKey(){
        this.$store.dispatch("addNote",this.input);
        this.$store.commit("addTimestamp",new Date().toLocaleString());

        this.input = "";
    }
}
</script>

<style scoped>
</style>
